<template>
	<view class="other">
		<u-cell v-for="(item, index) in list" :key="index"
			:title="item.name" isLink 
			:rightIconStyle="{
				fontSize: '30rpx'
			}"
			@click="$go(item.url, null, 'navigateTo', {noAuth: !item.needAuth})"
		></u-cell>
		
		<view class="logout p-2 flex justify-center align-center">
			<view class="btn">
				<u-button type="error" text="退出登录" shape="circle"
					@click="logout()"
				></u-button>
			</view>
		</view>
		<view class="blank"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
					{
						name: '更改密码',
						url: '/pages/user/change/index',
						needAuth: true
					},
					{
						name: '关于我们',
						url: '/pages/about/index'
					}
				]
			};
		},
		methods: {
			logout() {
				this.$store.dispatch("user/logout").then(res => {
					this.$go("/pages/user/login/index");
				}).catch(err => {
					this.$msg(err.message);
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.other{
	.logout{
		position: fixed;
		width: 100vw;
		bottom: 0;
		.btn{
			width: 500rpx;
		}
	}
}
</style>
